<div id="content">
<?php
	/* test */
	apuntarPartido(22, 3, 1);
	$a = REPLACE_Injection($_GET["a"]);
	if($a == 1){
		
	}else{
		$q = "SELECT 	p.goles_equipo1 as g1, 
								p.goles_equipo2 as g2, 
								e1.nombre as e1, 
								e2.nombre as e2, 
								t.estado as estado, 
								t.fecha as fecha, 
								t.id as id, 
								u.usuario as usuario, 
								p.imagen as imagen, 
								t.partido as partido   	
					FROM equipos as e1, equipos as e2, partido_torneo as p, tareas_partido as t, usuarios as u, jugadores as j1, jugadores as j2  
					WHERE e1.id = j1.equipo AND e2.id = j2.equipo AND j1.id = p.equipo1 AND j2.id = p.equipo2 AND t.partido = p.id AND u.id = t.usuario_origen AND t.estado = '".TASK_MATCH_SCORED."' 
					ORDER BY id DESC";
		$query = new mysqlQuery("tournament", $q, "", "", "", "", "");
		$query->execute();
		if($query->getCount() > 0){
			?>
			<h1>Task Management</h1>	
			<table border="0" cellspacing="0" cellpadding="0" class="table">
			<tr>
				<td class="title">Date</td>
				<td class="title">Status</td>
				<td class="title">User</td>
				<td class="title">Match Information</td>
				<td class="title">Screenshot</td>
				<td class="title" colspan="3">Operations</td>
			</tr>
			<?php
				$n = 0;
				while($row = $query->next()){
					$estado = obtenerEstadoTareaTexto($row["estado"]);
					echo '<tr>';
					echo '<td class="td'.(($n%2)+1).'"><strong>'.unixDateToHowLong($row["fecha"]).'</strong></td>';
					echo '<td class="td'.(($n%2)+1).'"><strong>'.$estado.'</strong></td>';
					echo '<td class="td'.(($n%2)+1).'"><strong>'.$row["usuario"].'</strong></td>';
					echo '<td class="td'.(($n%2)+1).'"><strong>'.$row["e1"].'</strong> ('.$row["g1"].') VS <strong>'.$row["e2"].'</strong> ('.$row["g2"].')</td>';
					if($row["imagen"])
						echo '<td class="td'.(($n%2)+1).'"><a href="'.$row["imagen"].'" target="_blank">Load the Screenshot</a></td>';
					else 
						echo '<td class="td'.(($n%2)+1).'"><strong>No picture</strong></td>';
					echo '<td class="td'.(($n%2)+1).'"><a href="index.php?s=match&id='.$row["partido"].'" target="_blank">Go to the Match</a></td>';
					echo '<td class="td'.(($n%2)+1).'"><a href="#">Validate</a></td>';	
					echo '</tr>';
					$n++;
				}
			?>
		</table>
		<?php 
		}else{
			$randomSentences = array(	"You can start thinking about preparing launch!", 
																"I think you can find something interesting in TV", 
																"Why don't you go and play in African Lobby, people say they are hard to win, cause of lag", 
																"Try to make some origami", 
																"Now you can start learning how to knit a pullover", 
																"Why don't you go to have some beer?... And bring me one!", 
																"Something smells bad... Go and have a shower!", 
																"I'm really proud of you. Your dog too. Feed him!", 
																"You can play some Modern Warfail 2 or something", 
																"What will you do now?", 
																"Your mother told you to tidy your room, it's good time to do it", 
																"I'm sure there is somebody to ban in the forum", 
																"", "", "", "", "", ""																
			);
			echo '<h1>Task Management</h1>';
			echo '<div id="error">Any task pending! '.$randomSentences[array_rand($randomSentences)].'</div>';
		}
	}
?>
</div>